package com.mbl.base.config.enums;


import com.baomidou.mybatisplus.core.enums.IEnum;

public enum ResultEnum implements IEnum {
    LOGIN_SUCCESS(200, "登录成功"),

    LOGIN_UN(700, "未登录"),
    LOGIN_ERROR(700, "登录异常"),
    LOGIN_PASS_ERROR(700, "密码错误"),
    LOGIN_ACCOUNT_UNKNOW(700, "找不到用户"),

    PARAME_ERR(401, "参数不对"),

    SERVER_ERR(500, "服务器异常")
    ;
    private int code;
    private String str;

    ResultEnum(int code, String str) {
        this.code = code;
        this.str = str;
    }

    public String getStr() {
        return str;
    }

    public void setStr(String str) {
        this.str = str;
    }

    public static ResultEnum codeOf(int code) {
        for (ResultEnum orderStatusEnum : values()) {
            if (orderStatusEnum.getValue() == code) {
                return orderStatusEnum;
            }
        }
        throw new RuntimeException("没有找到对应的枚举");
    }
    @Override
    public Integer getValue() {
        return code;
    }
}